#include<iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
	double a[n+1];
	for(int i=0;i<n+1;i++){
		cin>>a[i];
	}
	double m;
	cin>>m;
	double sum=0;
	double u=1;
	for(int i=n;i>=0;i--){
		sum+=u*a[i];
		//printf("%.2lf\n",sum);
		u*=m;
	}
	printf("%.2lf",sum);
} 
